package com.atguigu.msmservice.controller;

import com.atguigu.commonutils.R;
import com.atguigu.msmservice.Utils.RandomUtil;
import com.atguigu.msmservice.service.MsmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author ty
 */
@RequestMapping("/edumsm/msm")
@RestController
@CrossOrigin
public class MsmController {
    @Autowired
    private MsmService msmService;
    @GetMapping("send/{phone}")
    public R sendMsm(@PathVariable String phone){
        String code = RandomUtil.getFourBitRandom();
        Map<String, Object> map = new HashMap();
        map.put("code",code);
        boolean isSend = msmService.send(map,phone);
        return R.ok();
    }
}
